package com.brillilab.service.module.message.template.impl.usercenter;

import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

/**
 * @author zlb
 * @Title: BeforeUserExpireTemplate
 * @ProjectName brill_lab
 * @Description: TODO
 * @date 2019/10/14 10:53
 */
@Data
public class BeforeUserExpireTemplate extends AbstractMessageTemplate {
    private long expireDays;

    /**
     * @param labId       实验室Id
     * @param receiverId  userId
     * @param labMemberId PI的labMemberId
     * @param expireDays  实验室过期时间
     * @param referId     实验室Id
     */
    public BeforeUserExpireTemplate(Long labId, Long receiverId, Long labMemberId, Long expireDays, Long referId) {
        super(labId, receiverId);
        this.expireDays = expireDays;
        super.setType(MessageTypeEnum.BeforeUserExpire.getValue());
        super.setTitle("您的试用账号即将到期");
        super.setLabMemberId(labMemberId);
        super.setReferId(referId);
        String content = String.format("<span>您好，您的LabInOne试用账号试用期</span>" +
                        "<span style='color:#F6AC2D'>仅剩%s天</span>" +
                        "<span>，到期后您将无法对本实验室进行操作，请尽快完成分享升级为正式账号！</span>",
                expireDays);
        String appContent = String.format("您好，您的LabInOne试用账号试用期仅剩%s天</span>，到期后您将无法对本实验室进行操作，请尽快完成分享升级为正式账号！",
                expireDays);
        if (expireDays == 0) {
            //当天到期
            content = String.format("<span>您好，您的LabInOne试用账号试用期</span>" +
                    "<span style='color:#F6AC2D'>今天到期</span>" +
                    "<span>，到期后您将无法对本实验室进行操作，请尽快完成分享升级为正式账号！</span>");
            appContent = "您好，您的LabInOne试用账号试用期今天到期</span>，到期后您将无法对本实验室进行操作，请尽快完成分享升级为正式账号！";
        }
        super.setContent(content);
        super.setAppContent(appContent);
    }
}
